<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<style>
#yfzl_manage_div_1,#yfzl_manage_div_2,#yfzl_manage_div_div_3,#yfzl_manage_div_4,#yfzl_manage_div_5{
	padding: 10px;
}
#msg2 {
	height: 20px;
	color: red;
}
.modal-content {
	margin-top: 250px;
}
#change_title{
	color:red;
}
#yfzl_manage_div_detail{
	padding:30px 50px;
}
#yfzl_manage_div_table{
	margin-top:15px;
}
#yfzl_manage_div_table {
	text-align: center;
}
element.style {
    margin: 0px;
    height: 223px;
}
#wddd_manage_div{
	padding-top: 10px;
	background: #C8E5BC;
}
</style>
<body>
	<div id="wddd_manage_div" style="display: none;" class="row">
			<div id="">
				<div style="background: #5bc0de;margin: 0 auto;text-align: center;">
					<p style="line-height: 50px;letter-spacing: 15px;font-size: 28px;color: white;">我的订单</p>
				</div>
					<table id="yfzl_manage_div_table" class="table table-hover">
						<thead>
							<tr style="text-align: center;">
								<th style="text-align: center;">序号</th>
								<th style="text-align: center;">存放地点</th>
								<th style="text-align: center;">货柜号码</th>
								<th style="text-align: center;">衣服种类</th>
								<th style="text-align: center;">洗衣方法</th>
								<th style="text-align: center;">衣服数量</th>
								<th style="text-align: center;">总价格</th>
								<th style="text-align: center;">订单状态</th>
								<th style="text-align: center;">是否接单</th>
								<th style="text-align: center;">联系方式</th>
								<th style="text-align: center;">操作</th>
								<th style="text-align: center;">评价内容</th>
								<th style="text-align: center; display: none">id</th>
							</tr>
						</thead>
						<tbody id="wddd_manage_div_table_tbody">
							
						</tbody>
					</table>
				</div>
			</div>
<div class="modal fade" id="qu_pj" tabindex="-1" role="dialog"
		aria-labelledby="myModalLabel">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-label="Close">
						<span aria-hidden="true">&times;</span>
					</button>
					<h4 class="modal-title" id="change_title">评价订单</h4>
				</div>
				<form id="qu_pj_form">
					<div class="modal-body" id="change_div" style="text-align: center;">
							<div class="form-group">
           						 <textarea id="text" class="form-control" style="width: 100%;height: 250px;"></textarea>
        					  </div>
						<div id="msg2">
							<span class="msg2_span1"></span>
							<span class="msg2_span2"></span>
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
						<button type="submit" class="btn btn-primary">修改</button>
					</div>
				</form>
			</div>
		</div>
		</div>
</body>
<script type="text/javascript">
$("#wddd_manage_div").css("height",$(window).height() - 190 + "px");
var id = 0;
function pj(obj){
	$("#qu_pj").modal('show');
	id = $(obj).parent().parent().children("td:eq(12)").html();
}
$("#qu_pj_form").submit(function(){
	$.ajax({
		url : "qu_pj", //请求的url地址
		contentType : "application/json; charset=utf-8",
		dataType : "json", //返回格式为json
		type : "POST", //请求方式
		data : JSON.stringify({
			'pj':$("#text").val(),
			'id':id
		}),
		success : function(data) {
			if(data.isSuccess){
				$("#qu_pj").modal('hide');
				queryWddd();
			}else{
				alert("评价失败...");
			}
		},
		error : function(req) {
			alert("  error  请联系开发人员 ！");
		}
	});
	return false;
})
function queryWddd(){
	$.ajax({
		url : "query_wddd", //请求的url地址
		contentType : "application/json; charset=utf-8",
		dataType : "json", //返回格式为json
		type : "POST",
		beforeSend : function() {
		},
		success : function(data) {
			if(data.ddList.length > 0){
				var str = '';
				for(var i = 0;i < data.ddList.length;i++){
					str += "<tr><td>" + (i+1) + "</td><td>" + data.ddList[i].cfdd + "</td><td>"
					+ data.ddList[i].hghm + "</td><td>" + data.ddList[i].yfzl + "</td><td>" 
					+ data.ddList[i].xyff + "</td><td>" + data.ddList[i].yfsl + "</td><td>" + data.ddList[i].zj + "</td><td>" 
					+ data.ddList[i].ddzt + "</td><td>" + data.ddList[i].sfjd +"</td><td>"+ data.ddList[i].lxfs + "</td>";
					if(data.ddList[i].sfjd == "未接单"){
						str += "<td><button type='button' class='btn btn-danger' onclick='btnDeleteDd(this)'>删除</button></td>"
					}else{
						str += "<td><button type='button' class='btn btn-success'>已接单</button>"
						if(data.ddList[i].ddzt == "已经送回"){
							str += "&nbsp;&nbsp;/&nbsp;&nbsp;<button type='button' class='btn btn-success' onclick='pj(this)'>去评价</button>"
						}
						str += "</td>"
					}
					str += "<td>"+ data.ddList[i].pj +"</td>"+"<td style='display: none'>"+ data.ddList[i].id +"</td></tr>"
				}
				$("#wddd_manage_div_table_tbody").html(str);
			}else{
				$("#wddd_manage_div_table_tbody").html("没有数据");
			}
		},
		complete : function() {
			//请求完成的处理
			//alert("请求完成");
		},
		error : function(req) {
			alert("  error  请联系开发人员 ！");
		}
	});
}
function btnDeleteDd(obj){
	$.ajax({
		url : "user_delete_wddd", //请求的url地址
		contentType : "application/json; charset=utf-8",
		dataType : "json", //返回格式为json
		type : "POST", //请求方式
		data : JSON.stringify({
			'id':$(obj).parent().parent().children("td:eq(12)").html(),
			'cfdd':$(obj).parent().parent().children("td:eq(1)").html(),
			'hghm':$(obj).parent().parent().children("td:eq(2)").html()
		}),
		success : function(data) {
			if(data.isSuccess){
				queryWddd();
			}else{
				alert("删除失败...");
			}
		},
		complete : function() {
			//请求完成的处理
			//alert("请求完成");
		},
		error : function(req) {
			alert("  error  请联系开发人员 ！");
		}
	});
}
</script>
</html>